#ifndef SERVICE_CALLBACK_H
#define SERVICE_CALLBACK_H
#include <qobject.h>

class ServiceCallback : public QObject
{
    Q_OBJECT
public:
    ServiceCallback(QObject* parent = nullptr);
    virtual ~ServiceCallback();
public:
    void start(const QString& url);

    template<class A, class B, class C, class D, class E>
    void start(const QString& url,const A& a,const B& b,const C& c,const D& d,const E& e)
    {
        QString target = QString(url).arg(a).arg(b).arg(c).arg(d).arg(e);
        start(target);
    }

    template<class A, class B, class C, class D>
    void start(const QString& url,const A& a,const B& b,const C& c,const D& d)
    {
        QString target = QString(url).arg(a).arg(b).arg(c).arg(d);
        start(target);
    }

    template<class A, class B, class C>
    void start(const QString& url,const A& a,const B& b,const C& c)
    {
        QString target = QString(url).arg(a).arg(b).arg(c);
        start(target);
    }

    template<class A, class B>
    void start(const QString& url,const A& a,const B& b)
    {
        QString target = QString(url).arg(a).arg(b);
        start(target);
    }

    template<class A>
    void start(const QString& url,const A& a)
    {
        QString target = QString(url).arg(a);
        start(target);
    }
signals:
    void onCallback(const QByteArray& buffer);
};

#endif